module BrainfuckTranslators where

-- | Brainfuck to Boolfuck translator
brainfToBoolf :: [Char] -> [Char]
brainfToBoolf txt =  concatMap (++ "\n") $ map (brainfToBoolfChars) txt

-- | Translates a Brainfuck character into a Boolfuck order
brainfToBoolfChars :: Char -> [Char]
brainfToBoolfChars '+' = ">[>]+<[+<]>>>>>>>>>[+]<<<<<<<<<"
brainfToBoolfChars '-' = ">>>>>>>>>+<<<<<<<<+[>+]<[<]>>>>>>>>>[+]<<<<<<<<<"
brainfToBoolfChars '<' = "<<<<<<<<<"
brainfToBoolfChars '>' = ">>>>>>>>>"
brainfToBoolfChars ',' = ">,>,>,>,>,>,>,>,<<<<<<<<"
brainfToBoolfChars '.' = ">;>;>;>;>;>;>;>;<<<<<<<<"
brainfToBoolfChars '[' = ">>>>>>>>>+<<<<<<<<+[>+]<[<]>>>>>>>>>[+<<<<<<<<[>]+<[+<]"
brainfToBoolfChars ']' = ">>>>>>>>>+<<<<<<<<+[>+]<[<]>>>>>>>>>]<[+<]"
brainfToBoolfChars _ = ""

-- | Brainfuck to DNA# translator
brainfToDNASharpLineForm :: [Char] -> [Char]
brainfToDNASharpLineForm txt =  concat $ map (brainfToDNASharpChar) txt

-- | Translates a Brainfuck character into a DNA# string
brainfToDNASharpChar :: Char -> [Char]
brainfToDNASharpChar '+' = "ATTA"
brainfToDNASharpChar '-' = "ATCG"
brainfToDNASharpChar '<' = "ATGC"
brainfToDNASharpChar '>' = "ATAT"
brainfToDNASharpChar ',' = "GCAT"
brainfToDNASharpChar '.' = "GCGC"
brainfToDNASharpChar '[' = "GCTA"
brainfToDNASharpChar ']' = "GCCG"
brainfToDNASharpChar _ = ""

-- | Brainfuck to Brainloller translator.
brainfToBrainloller :: [Char] -> [(Int, Int, Int)]
brainfToBrainloller txt = map (brainfToBrainlollerChars) txt

-- | Translates a Brainfuck character into a Brainloller RGB code
brainfToBrainlollerChars :: Char -> (Int, Int, Int)
brainfToBrainlollerChars '+' = (0,255,0)
brainfToBrainlollerChars '-' = (0,128,0)
brainfToBrainlollerChars '<' = (255,0,0)
brainfToBrainlollerChars '>' = (128,0,0)
brainfToBrainlollerChars ',' = (0,0,128)
brainfToBrainlollerChars '.' = (0,0,255)
brainfToBrainlollerChars '[' = (255,255,0)
brainfToBrainlollerChars ']' = (128,128,0)
brainfToBrainlollerChars _ =  (0,0,0)
